home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-15 | 12.3 KB | 433 lines | [TEXT/MPS ] |
- //
- // appRules.r
- //
- // This example demonstrates usage of the Easy and Custom Install
- // frameworks for use in installing an application.
- //
- // System version screening, as well as customized user interface and
- // installation contents based on existing system version of selected
- // target volume are included.
- //
- // All files are installed to folder "System Rules App Example:" on
- // root folder of selected target volume for the installation.
- //
- // IMPORTANT: It should be noted that this example portrays TeachText
- // as having system requirements of 7.0 or 7.5, in addition to the claim
- // that System 6 is not supported. There is no factual basis for this
- // portrayal. TeachText is used only as an example and has not mutated
- // were not looking.
- //
- //
- // mark young • 08/24/94
- //
- // Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
- //
-
- #include "InstallerTypes.r"
-
-
- // constants for packages, comments, comment text
- #define k75Package 100
- #define k70Package 200
- #define kSeperatorLine 9999
-
- // target spec of system file for comparing system versions
- #define kSystemFileTarget 20001
-
-
-
-
- // • easy install setup
-
- // easy install framework uses ID other than 765 or 766
- // recommended to always use ID 764
- resource 'infr' (764) {
- format0 {{
- // execute first true rule, if none are true then return false
- pickFirst, { 700, 800, 900 }, // check system version, if bad give error
- }}
- };
-
- // rule that adds 7.5 or greater compatable file to Easy Install
- resource 'inrl' (700) {
- format0 {{
- // check for 7.5 or greater
- CheckFileVersion{ kSystemFileTarget, 7, 5, release, 0 },
-
- // if 7.5 or greater add that package
- AddPackages{{ k75Package }},
- AddUserDescription{ "Install 7.5 compatable version of TeachText." },
- }}
- };
-
- // rule that adds 7.0 or greater compatable file to Easy Install
- resource 'inrl' (800) {
- format0 {{
- // check for 7.0 or greater
- CheckFileVersion{ kSystemFileTarget, 7, 0, release, 0 },
-
- // if 7.0 or greater add that package
- AddPackages{{ k70Package }},
- AddUserDescription{ "Install 7.0 compatable version of TeachText." },
- }}
- };
-
-
- // • custom install setup
-
- // custom install framework always uses ID of 766
- resource 'infr' (766) {
- format0 {{
- pickFirst, { 1000, 900 }, // check system version, if bad give error
- }}
- };
-
- // rule that checks system version of target volume
- resource 'inrl' (1000) {
- format0 {{
- // this returns false unless system version is greater than 7.0
- CheckFileVersion{ kSystemFileTarget, 7, 0, release, 0 },
- AddCustomItems{{ k75Package, kSeperatorLine, k70Package }},
- }}
- };
-
- // • used in both easy and custom
- resource 'inrl' (900) {
- format0 {{
- ReportVolError{ "System 7.0 or greater required for installation !!" }
- }}
- };
-
-
- // • packages
-
- // 7.5 or greater
- resource 'inpk' ( k75Package ) {
- format0 {
- showsOnCustom, // if a subpackage, then show in Custom Install
- removable, // include package or subpackage as a removeable item
- dontForceRestart,// don't make user reboot his computer after install
- k75Package, // ID of package comments ( 'inpc' ) rsrc defined below
- 0, // Package size ( if 0, filled in by ScriptCheck )
-
- "7.5 compatable version of TeachText.",
- // Custom Install selection text
-
-
- { // Package parts list ( all the stuff to be included
- // in package ) These parts can be 'inpk', 'infa', 'inra',
- // 'inr#', 'inrm', 'inff', 'infm', 'inaa', 'inat', 'inat',
- // or 'inbb'
-
- 'infa', 1075; // 7.5 compatable file
- },
- }
- };
-
-
- // seperator line in Custom Install list of options
- resource 'inpk' ( kSeperatorLine ) {
- format0 {
- showsOnCustom, // if a subpackage, then show in Custom Install
- removable, // include package or subpackage as a removeable item
- dontForceRestart,// don't make user reboot his computer after install
- 0, // no comments for a seperator line
- 0, // no size for a seperator line
- "-", // display dashed line in Custom Install list of options
- {
- // parts list is empty for seperator line
- },
- }
- };
-
- // 7.5 or greater
- resource 'inpk' ( k70Package ) {
- format0 {
- showsOnCustom, // if a subpackage, then show in Custom Install
- removable, // include package or subpackage as a removeable item
- dontForceRestart,// don't make user reboot his computer after install
- k70Package, // ID of package comments ( 'inpc' ) rsrc defined below
- 0, // Package size ( if 0, filled in by ScriptCheck )
-
- "7.0 compatable version of TeachText.",
- // Custom Install selection text
-
-
- { // Package parts list ( all the stuff to be included
- // in package ) These parts can be 'inpk', 'infa', 'inra',
- // 'inr#', 'inrm', 'inff', 'infm', 'inaa', 'inat', 'inat',
- // or 'inbb'
-
- 'infa', 1070; // 7.0 compatable file
- },
- }
- };
-
-
-
- // • package comments
-
- // NOTE: The actual file that will be installed in either package is actually
- // TeachText. The information detailed below does not actually correspond to
- // the file being installed and is intended only as an example of how to
- // prepare custom package information resources.
-
- // FURTHER NOTE: The values that are assigned to the Custom Package Information
- // resource
- // fields do not actually have any effect on the installation and are ignored
- // during installation. They can however assist the user in choosing which
- // packages they would like to include in their Custom Installation or Custom
- // Removal.
-
- // The following included file contains the icons for the two package comments.
- // I created the file with the icon resources ( 'ICN#, 'icl4' and 'icl8' )
- // by opening the application to be installed within ResEdit. I then copied
- // the 'ICN#', 'icl4' and 'icl8' icon resources into a new ResEdit file called
- // "Icons.rsrc" and assigned the resource items an ID of 9128, since their
- // original resource ID's had a value that was illegal for use with 'inpc'
- // resources ( they must be over 1024 ).
- // - An alternative to this method is to derez the application and to paste
- // the resulting resource definitions into this script file and to let the
- // Rez command build the icons every time that the installer script is Rezzed.
- // If you happen to forget to include the resources for the icons, ScriptCheck
- // will complain, but you will still be able to use the Rezzed installer script
- // to successfully perform an installation.
- include "Icons.rsrc";
-
- resource 'inpc' ( k75Package ) {
- format1 {
- 8021994, // sample date ( 08/02/94 )
- 403, // sample version ( 4.0.3 )
-
- 2500 * 1024, // RAM required for package ( 2.5 megabytes )
-
- 9128, // icon rsrc ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item in rezzed script file
-
- k75Package, // 'TEXT' resource ID of item
- // containing package description
-
- }
- };
-
- resource 'inpc' ( k70Package ) {
- format1 {
- 8021994, // sample date ( 08/02/94 )
- 403, // sample version ( 4.0.3 )
-
- 4250 * 1024, // RAM required for package ( 4.25 megabytes )
-
- 9128, // icon rsrc ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item in rezzed script file
-
- k70Package, // 'TEXT' resource ID of item
- // containing package description
- }
- };
-
-
- // The following resource items can easily be created manually by creating 'TEXT'
- // resource items in a file and including that file in this script.
- // USE: include "fileWithTextItem.rsrc";
- // NOTE : resource includes use "include" instead of "#include"
- // and are terminated with a semicolon.
- data 'TEXT' ( k75Package ) {
- "This is some sample text that would describe what "
- "the 7.5 compatible package contains."
- };
-
- data 'TEXT' ( k70Package ) {
- "This is some sample text that would describe what "
- "the 7.0 compatible package contains."
- };
-
-
-
- // • file atoms
-
- // file atom for extension
- resource 'infa' (1075) {
- format1 {
- deleteWhenRemoving,
- deleteWhenInstalling,
- copy,
- dontIgnoreLockedFile,
- dontSetFileLocked,
- useSrcCrDateToCompare,
- srcNeedExist,
- rsrcForkInRsrcFork,
- leaveAloneIfNewer,
- updateExisting,
- copyIfNewOrUpdate,
- rsrcFork,
- dataFork,
- 0,
- 0x0,
- 10075,
- {
- 10076,
- 0,
- 0
- },
- 0,
- 0,
- 0,
- "TeachText • 7.5"
- }
- };
-
- // file atom for extension
- resource 'infa' (1070) {
- format1 {
- deleteWhenRemoving,
- deleteWhenInstalling,
- copy,
- dontIgnoreLockedFile,
- dontSetFileLocked,
- useSrcCrDateToCompare,
- srcNeedExist,
- rsrcForkInRsrcFork,
- leaveAloneIfNewer,
- updateExisting,
- copyIfNewOrUpdate,
- rsrcFork,
- dataFork,
- 0,
- 0x0,
- 10070,
- {
- 10071,
- 0,
- 0
- },
- 0,
- 0,
- 0,
- "TeachText • 7.0"
- }
- };
-
-
- // • file specs
-
- // target file spec TeachText application for 7.5
- resource 'intf' (10075) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'APPL', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- ":System Rules App Example:TeachText • 7.5" // path to target file
- }
- };
-
- // source file spec for TeachText application for 7.5
- resource 'infs' (10076) {
- 'APPL', // TYPE for file search
- 'ttxt', // CREATOR for file search
-
- 0x1, // creation DATE for source file
- // ( value of 1, filled in by ScriptCheck
-
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:TeachText • 7.5" // PATH to source file
- };
-
-
- // target file spec for TeachText application for 7.0
- resource 'intf' (10070) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'APPL', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- ":System Rules App Example:TeachText • 7.0" // path to target file
- }
- };
-
- // source file spec for TeachText application for 7.0
- resource 'infs' (10071) {
- 'APPL', // TYPE for file search
- 'ttxt', // CREATOR for file search
-
- 0x1, // creation DATE for source file
- // ( value of 1, filled in by ScriptCheck
-
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:TeachText • 7.0" // PATH to source file
- };
-
-
-
- // target file spec for checking System version on target
- resource 'intf' ( kSystemFileTarget ) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be found when this
- // target spec is referenced from
- // within the rules framework.
-
- 'zsys', // TYPE for file
- 'MACS', // CREATOR for file
-
- 0, // finder attribute flags
-
- 1, // creation date
- 1, // modification date
-
- 0, // search proc ID ( 'insp' ), none used
-
- "special-macs:System" // path to target file
- }
- };
-